module.exports = {
    dataKey: {
        qrcodeData:'qrcodeData',
        session_key:'session_key',
        userInfo: 'userInfo',
        token: 'token',
        uid:'uid',
        recordList:'recordList',
        recommendData:'recommendData',
        liveData:'liveData',
        tip_banner:'tip_banner',
        wx_no:'wx_no',
        is_host:'is_host',
        step_num:'step_num',
        login_time:'login_time'

    },
    setData: (key, data) => {
        return new Promise((resolve, reject) => {
            wx.setStorage({
                key,
                data,
                success: resolve,
                fail: reject
            });
        });
    },
    getData: key => {
        return new Promise((resolve, reject) => {
            wx.getStorage({
                key,
                success: res => {
                    if (res.errMsg === 'getStorage:ok') {
                        resolve(res.data);
                    } else {
                        reject(res.errMsg);
                    }
                },
                fail: reject
            });
        });
    },
    removeData: key => {
        return new Promise(resolve => {
            wx.removeStorage({
                key,
                success: resolve,
                fail: resolve
            });
        });
    },
    clearData: () => {
        return new Promise((resolve, reject) => {
            wx.clearStorage();
            resolve();
        });
    },
};
